<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .change{
            width: 100px;
            height: 100px;
            background-color: aqua;
        }
    </style>
</head>

<body>
    <div class="function">
        <button id='btn1'>blue</button>
        <button id="btn2">red</button>
        <button id="btn3">green</button>
    </div>
    <div class="change">

    </div>
</body>
<script>
    btn1 = document.getElementById('btn1')
    ele = document.querySelector('.change')
    btn1.onclick = function(){
        ele.style.backgroundColor='blue'
    }
    btn2 = document.getElementById('btn2')
    btn2.onclick = function(){
        ele.style.backgroundColor='red'
    }
    btn3 = document.getElementById('btn3')
    btn3.onclick = function(){
        ele.style.backgroundColor='green'
    }
</script>
</html>